import math
class Shape:
    count=0
    def __init__(self,c):
        self.__color = c
        Shape.count+=1

    def setColor(self,c):
        self.__color = c

    def getColor(self):
        return self.__color

    def getArea(self):
        pass

    def getC(self):
        pass

    @classmethod
    def getcount(cls):
        return cls.count

    def __str__(self):
        return ("颜色"+str(self.__color))

class Circle(Shape):
    def __init__(self,c,r):
        super().__init__(c)
        self.__radius = r
    def getArea(self):
        return math.pi * self.__radius**2
    def getC(self):
        return 2*math.pi*self.__radius
    def __str__(self):
        return ( "圆形：{}，半径{}".format( super().__str__(),self.__radius))
#长方形
class Rectangle(Shape):
    def __init__(self,c,l,w):
        super().__init__(c),
        self.__length = l
        self.__weigth = w
    def getArea(self):
        return self.__length*self.__weigth
    def getC(self):
        return 2*(self.__length+self.__weigth)
    def __str__(self):
        return ("矩形：{}，长{}，宽{}".format( super().__str__(),self.__length,self.__weigth))

c = Circle("red",5)
print(c)
c.setColor('green')
print("颜色{},周长{},面积{}".format(c.getColor(),c.getC(), c.getArea()))

rec = Rectangle("blue",6,9)
print(rec)
print("颜色{},周长{},面积{}".format(rec.getColor(),rec.getC(), rec.getArea()))

s=Shape("yellow")
print(s)

#调用对象
lst=[Circle("pink",8),Rectangle("blue",6,9),Circle("green",7)]
for item in lst:
    print(item)
    print("周长{},面积{}".format(item.getC(), item.getArea()))
    
print("图形总数量：",Shape.getcount())